import React from 'react';
import './index.less';
import ajax from '../../utils/ajax';
import '../../utils/index';
import { Row, Col,notification } from 'antd';

//展示欢迎界面
 
var _this;
class Welcome extends React.Component {
	
	state = {
     userData:[],
  };
	
	componentWillMount(){
		 _this=this;
     ajax.post({
        "url": '/user/getCurrentUser',
        "success": function (res) {
        	 if(res.errorCode==200){
        	 	    res.data.status=("enabled")?"可用":"不可用";
                res.data.createTime=new Date(res.data.createTime).format("yyyy-MM-dd HH:mm:ss");
                _this.setState({userData:res.data});  
        	 	}
        	  else{
        	  	   notification.error({
                   message: '出错啦!',
                   description: `请联系管理员处理`,
                   duration: 0,
                  });
        	  	}
              
        }
     })
		
		}

  render() {
  	const userData= this.state.userData;
    return (
    <div>
    <Row type="flex">
      <Col span={3}><span className="spanHeight">登录名称：</span></Col>
      <Col span={6}><span className="spanHeight">{userData.username}</span></Col>
      <Col span={3}><span className="spanHeight">真实名字：</span></Col>
      <Col span={6}><span className="spanHeight">{userData.realname}</span></Col>
    </Row>
    <Row type="flex">
      <Col span={3}><span className="spanHeight">电话：</span></Col>
      <Col span={6}><span className="spanHeight">{userData.phone}</span></Col>
      <Col span={3}><span className="spanHeight">E-Mail：</span></Col>
      <Col span={6}><span className="spanHeight">{userData.email}</span></Col>
    </Row>
    <Row type="flex">
      <Col span={3}><span className="spanHeight">创建时间：</span></Col>
      <Col span={6}><span className="spanHeight">{userData.createTime}</span></Col>
      <Col span={3}><span className="spanHeight">可用状态：</span></Col>
      <Col span={6}><span className="spanHeight">{userData.status}</span></Col>
    </Row>
    <Row type="flex">
      <Col span={3}><span className="spanHeight">所属机构：</span></Col>
      <Col span={6}><span className="spanHeight">总公司</span></Col>
    </Row>
  </div>
    );
  }

}

export default Welcome;
